<div align="left">
<?
unset($params);
$params[sid] = $sid;
$params[action] = 'tickets';
$params[option] = 'reseller_support';
$url = "$baseURL/$webDIR/?".encode_params($params);
?>
<strong><?=translate('main_title')?> &raquo; <a href="<?=$url?>"><?=translate('sub_title')?></a> &raquo; <?=translate('ticket_num')?> <?=$ticket['id']?>
</div>
<br><br>
<? if($statusMsg){ ?><div style="color:red;"><br><strong><?=$statusMsg?></strong></div><br><? } ?>
<table border="0" cellpadding="0" cellspacing="0" class="bTable">
    <tr> 
      <td width="100" align="right"><strong><?=translate('ticket_num')?></strong></td>
      <td width="200"><?=$ticket['id']?></td>
      <td width="150" align="right" style="border-left: 1px solid #CCCCCC;"><strong><?=translate('subject')?></strong></td>
      <td nowrap width="250" style="border-left: 1px solid #CCCCCC;">&nbsp;<?=htmlspecialchars(stripslashes($ticket['short_dsc']))?></td>
    </tr>
    <tr> 
      <td align="right" nowrap><strong><?=translate('issue')?></strong></td>
      <td><?=$ticket['problem']?></td>
	  <td colspan="2" rowspan="6" valign="top" style="border-left: 1px solid #CCCCCC; border-bottom: 0px;"><?=nl2br(htmlspecialchars(stripslashes($ticket['description'])))?></td>
    </tr>
<? if(!$ticket['status']){ ?>
    <tr> 
      <td height="25" align="right"><strong><?=translate('open_date')?></strong></td>
      <td nowrap><?=$ticket['open_date']?></td>
    </tr>
<? }else{ ?>
    <tr> 
      <td align="right"><strong><?=translate('close_date')?></strong></td>
      <td nowrap><?=$ticket['close_date']?></td>
    </tr>
<? } ?>
    <tr> 
      <td align="right" nowrap><strong><?=translate('domain')?></strong></td>
      <td nowrap><a href="http://<?=$ticket['cdomain']?>" target="_blank"><?=$ticket['cdomain']?></a></td>
    </tr>
    <tr> 
      <td align="right" nowrap><strong><?=translate('email')?></strong></td>
      <td nowrap><a href="mailto:<?=$ticket['cemail']?>?&subject=Support%20Ticket%20ID%20<?=$ticket['id']?>&body=Hello,<br><br><br><br>Best%20Regards,<br><?=$fullname?>"><?=$ticket['cemail']?></a></td>
    </tr>
    <tr> 
      <td align="right"><strong><?=translate('status')?></strong></td>
      <td>
	  			<?
	   					unset($params);
                        $params[sid] = $sid;
                        $params[action] = 'tickets';
                        $params[option] = 'open_my_ticket';
                        $params[tid] = $ticketsArr[$i]['id'];
                        $url = "$baseURL/$webDIR/?".encode_params($params);
                    ?>
	   <? if($ticket['status']){
	   			unset($params);
				$params[sid] = $sid;
				$params[action] = 'tickets';
				$params[option] = 'open_my_ticket';
				$params[tid] = $ticket['id'];
				$params[reopen] = 1;
				$url = "$baseURL/$webDIR/?".encode_params($params);
				
		   		print 'Closed';
				if($ticket['status'] == 1) print ' <a href="'.$url.'">(Reopen It)</a>';
		   }else{
	   			unset($params);
				$params[sid] = $sid;
				$params[action] = 'tickets';
				$params[option] = 'open_my_ticket';
				$params[tid] = $ticket['id'];
				$params[close] = 1;
				$url = "$baseURL/$webDIR/?".encode_params($params);
		  		print Open.' <a href="'.$url.'">(Close It)</a>';
		   
		   } 
		?></td>
    </tr>
</table>
  <br><br>
 <? if($ticket['status'] and $ticket['vote1']){ ?>
  <table class="bTable" border="0" cellspacing="0">
  <tr><th width="20%"><?=translate('timeliness')?></th><th width="25%"><?=translate('satisfaction')?></th><th width="25%"><?=translate('courtesy')?></th><th width="30%"><?=translate('overall')?></th></tr>
  <tr><td align="center"><?=$ticket['vote1']?></td><td align="center"><?=$ticket['vote2']?></td><td align="center"><?=$ticket['vote3']?></td><td align="center"><?=$ticket['vote4']?></td></tr>
  <tr><td align="right" valign="top"><strong><?=translate('vote_description')?></strong></td><td colspan="3" align="justify" style="border-left: 1px solid #EEEEEE;"><?=nl2br(htmlspecialchars(stripslashes($ticket['vote_dsc'])))?></td></tr>
</table>
  <br><br><br>
 <? }elseif($ticket['status']){ ?>
 <div style="height: 40px; width: 550px" class="bTable">
 <?
		unset($params);
		$params[sid] = $sid;
		$params[action] = 'tickets';
		$params[option] = 'vote';
		$params[tid] = $ticket['id'];
		$url = "$baseURL/$webDIR/?".encode_params($params);
 ?>
 <a href="<?=$url?>"><?=translate('rate_ticket')?></a> <?=translate('rate_tips')?></div>
<br>
 <? } ?>
<? if($commentsArr){ ?>
<table class="bTable" border="0" cellspacing="0">
<? for($i = 0; $i < count($commentsArr); $i++){ ?>
<?
	if($commentsArr[$i]['from_user'] != $GLOBALS['userName']) $commentsArr[$i]['from_user'] = 'RP Support';
	if($commentsArr[$i]['to_user'] != $GLOBALS['userName']) $commentsArr[$i]['to_user'] = 'RP Support';
?>
<tr><th align="right"><? print get_mysql_date('Y-m-d H:i:s', $commentsArr[$i]['cdate'])?> <?=translate('by')?> <? if($commentsArr[$i]['from_user']) print $commentsArr[$i]['from_user']; else print $commentsArr[$i]['from_group']; ?> <?=translate('to')?> <? if($commentsArr[$i]['to_user']) print $commentsArr[$i]['to_user']; else print $commentsArr[$i]['to_group']; ?></th></tr>
<tr><td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="400" rowspan="2" valign="top">
<? if($commentsArr[$i]['from_group'] == 'resellers') print '<span style="color:red">'; ?>
<?=nl2br(htmlspecialchars(stripslashes($commentsArr[$i]['comment'])))?>
<? if($commentsArr[$i]['from_group'] == 'resellers') print '</span>'; ?>
</td>
<td width="150" align="right" valign="top" style="border-bottom:0px">
<? if($commentsArr[$i]['from_user'] == 'RP Support'){ ?>
<? if(!$commentsArr[$i]['vote1']){ ?>
<form name="rateComment<?=$commentsArr[$i]['id']?>" id="rateComment<?=$commentsArr[$i]['id']?>" action="<?=$_SERVER[PHP_SELF].'?'.$_SERVER[QUERY_STRING]?>" method="post" enctype="multipart/form-data" style="padding: 0px; margin: 0px;">
<strong style="padding-right:30px"><?=translate('vote')?></strong>
	<br>
	<?=translate('satisfaction')?>
	<select name="vote1" class="field" id="vote1">
          <option value="5" selected>5</option>
          <option value="4">4</option>
          <option value="3">3</option>
          <option value="2">2</option>
          <option value="1">1</option>
        </select>
		<br>
		<?=translate('courtesy')?>
	<select name="vote2" class="field" id="vote2">
          <option value="5" selected>5</option>
          <option value="4">4</option>
          <option value="3">3</option>
          <option value="2">2</option>
          <option value="1">1</option>
        </select>
		<br>
		<?=translate('overall')?>
	<select name="vote3" class="field" id="vote3">
          <option value="5" selected>5</option>
          <option value="4">4</option>
          <option value="3">3</option>
          <option value="2">2</option>
          <option value="1">1</option>
        </select>
		<br>
		<?=translate('timeliness')?>
	<select name="vote4" class="field" id="vote4">
          <option value="5" selected>5</option>
          <option value="4">4</option>
          <option value="3">3</option>
          <option value="2">2</option>
          <option value="1">1</option>
        </select>
		<br>
		<input name="cid" type="hidden" value="<?=$commentsArr[$i]['id']?>">
		<input type="submit" name="rateit" id="rateit" class="button" value="Rate It">
	
</form>
<? }else{ ?>
<strong style="padding-right:30px"><?=translate('vote')?></strong>
<br>
<?=translate('satisfaction')?> <?=$commentsArr[$i]['vote1']?>
<br>
<?=translate('courtesy')?> <?=$commentsArr[$i]['vote2']?>
<br>
<?=translate('overall')?> <?=$commentsArr[$i]['vote3']?>
<br>
<?=translate('timeliness')?> <?=$commentsArr[$i]['vote4']?>
<? } ?>
<? } ?>
</td>
</tr>
<tr>
<td valign="top">
<? if($commentsArr[$i]['attachment']){ ?>
<strong><?=translate('attachment')?></strong>
<?
	unset($params);
	$params[sid] = $sid;
	$params[action] = 'tickets';
	$params[option] = 'download';
	$params[filename] = $commentsArr[$i]['attachment'];
	$params[cid] = $commentsArr[$i]['id'];
	$url = "$baseURL/$webDIR/?".encode_params($params);
?>
<a href="<?=$url?>">
<?=$commentsArr[$i]['attachment']?></a><br><strong><?=translate('size')?></strong> <?=number_format($commentsArr[$i]['attachment_size']/1024, 2, '.', ',')?> KB
<? }else{ ?>
&nbsp;
<? } ?>
</td>
</tr>
</table>
</td></tr>
<? } ?>
<tr><th>
	<? if($pages['sel'] != ($pages['start']+1))
	{
	   	unset($params);
		$params[sid] = $sid;
		$params[action] = 'tickets';
		$params[option] = 'open_my_clients_ticket';
		$params[tid] = $ticket['id'];
		$params[pages][count] = $pages['count'];
		$params[pages][shift] = $pages['shift'];
		$params[pages][sel] = 1;		
		$url = "$baseURL/$webDIR/?".encode_params($params);
		echo "<a href='".$url."'>first</a>";
	}else print "first";
	?>
	<? if($pages['sel'] != ($pages['start']+1))
	   {
	   	unset($params);
		$params[sid] = $sid;
		$params[action] = 'tickets';
		$params[option] = 'open_my_clients_ticket';
		$params[tid] = $ticket['id'];
		$params[pages][count] = $pages['count'];
		$params[pages][shift] = $pages['shift'];
		$params[pages][sel] = $pages['sel']-1;		
		$url = "$baseURL/$webDIR/?".encode_params($params);
		echo "<a href='".$url."'>&lt;&lt;</a>";
	    }else echo "&lt;&lt;";
	?>
	<? for($i = $pages['start']; $i < $pages['end']; $i++)
		{
			if($i == ($pages['sel'] - 1)){
				echo '['; echo $i+1; if($i == ($pages['sel'] - 1)) echo ']';
			}else{
	   			unset($params);
				$params[sid] = $sid;
				$params[action] = 'tickets';
				$params[option] = 'open_my_clients_ticket';
				$params[tid] = $ticket['id'];
				$params[pages][count] = $pages['count'];
				$params[pages][shift] = $pages['shift'];
				$params[pages][sel] = $i+1;		
				$url = "$baseURL/$webDIR/?".encode_params($params);
				echo " <a href='".$url."'>".($i+1)."</a> ";
			}
		}
	?>
	<? if($pages['sel'] != $pages['end'])
	   {
	   	unset($params);
		$params[sid] = $sid;
		$params[action] = 'tickets';
		$params[option] = 'open_my_clients_ticket';
		$params[tid] = $ticket['id'];
		$params[pages][count] = $pages['count'];
		$params[pages][shift] = $pages['shift'];
		$params[pages][sel] = $pages['sel']+1;		
		$url = "$baseURL/$webDIR/?".encode_params($params);
		 echo "<a href='".$url."'>&gt;&gt;</a>";
		}else echo "&gt;&gt;";
	?>
	<? if($pages['sel'] != $pages['end'])
	   {
	   	unset($params);
		$params[sid] = $sid;
		$params[action] = 'tickets';
		$params[option] = 'open_my_clients_ticket';
		$params[tid] = $ticket['id'];
		$params[pages][count] = $pages['count'];
		$params[pages][shift] = $pages['shift'];
		$params[pages][sel] = $pages['total'];		
		$url = "$baseURL/$webDIR/?".encode_params($params);
	   	echo "<a href='".$url."'>last</a>";
	   }else echo "last";
	?>
</th></tr>
</table>
<? } ?> 
<? if(!$ticket['status']){ ?>
  <br><br>
  <form name="commentForm" id="commentForm" method="post" action="<?=$_SERVER[PHP_SELF].'?'.$_SERVER[QUERY_STRING]?>" enctype="multipart/form-data">
  <table class="bTable" border="0" cellspacing="0">
    <tr> 
      <th colspan="2"><?=translate('ticket_num')?> [ <?=$ticket['id']?> ] ::  <?=translate('add_comment')?></th>
    </tr>
    <tr> 
      <td align="right" valign="top" width="108"><strong><?=translate('comment')?></strong></td>
      <td> 
        <textarea id="tcomment"  name="tcomment" cols="40" rows="7"></textarea>
      </td>
    </tr>
    <tr> 
      <td align="right" width="108"><strong><?=translate('attachment')?></strong></td>
      <td> 
        <input name="attachment" type="file" id="attachment" size="32">
      </td>
    </tr>
    <tr> 
      <td align="right" width="108">&nbsp;</td>
      <td><input type="submit" name="Submit" value="<?=translate('submit')?>" style="width: 100px">
      <input type="hidden" name="do" value="submit_comment" />      </td>
    </tr>
  </table>
</form>
<? } ?>